<script>
import {saveWorkOrder} from "@/api/aihuman/board";

export default {
  name: "CustomerService",
  data() {
    return {
      ruleForm: {
        linkman: '',
        contactNumber: '',
        content: ''
      },
      rules: {
        linkman: [
          {required: true, message: '请输入联系人姓名', trigger: 'blur'},
        ],
        contactNumber: [
          {required: true, message: '请输入联系人手机号码', trigger: 'blur'},
        ],
        content: [
          {required: true, message: '请输入需求描述', trigger: 'blur'},
        ]
      }
    }
  },
  methods: {
    close(){
      this.$emit('ok')
    },
    submit() {
      this.$refs['ruleForm'].validate((valid) => {
        if (valid) {
          saveWorkOrder(this.ruleForm).then(res => {
            this.$message.success('提交成功')
            this.$emit('ok')
          })
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    }
  }
}
</script>

<template>
  <div>
    <div class="banner">
      <div>
        <div class="banner-text1">
          SERVICE
        </div>
        <div class="banner-text2">
          有爱服务|一切为了用户体验
        </div>
        <div class="banner-text3">
          400-890-1388
        </div>
      </div>
    </div>
    <div class="title-block">
      <div class="title-block__text">定制服务</div>
      <div class="title-block__meta">专家顾问将在24小时内向您致电</div>
    </div>
    <div class="form-block">

      <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px">
        <el-form-item label="联系人姓名" prop="linkman" style="margin-bottom: 50px;">
          <el-input v-model="ruleForm.linkman" placeholder="请输入您的姓名"></el-input>
        </el-form-item>
        <el-form-item label="联系人手机号码" prop="contactNumber" style="margin-bottom: 50px;">
          <el-input v-model="ruleForm.contactNumber" placeholder="请输入您的手机号"></el-input>
        </el-form-item>
        <el-form-item label="需求描述" prop="content" style="margin-bottom: 50px;">
          <el-input
            v-model="ruleForm.content"
            type="textarea"
            placeholder="请输入您的需求，专家顾问将在24小时内向您致电"
            :rows="8"
            maxlength="100"
            show-word-limit=""></el-input>
        </el-form-item>
      </el-form>
      <div class="submit-btn">
        <el-button @click="close">返回
        </el-button>
        <el-button type="primary" @click="submit">提交</el-button>
      </div>
    </div>

  </div>
</template>

<style scoped lang="scss">
/deep/ .el-form-item__label {
  text-align: left;
}

.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;

  .el-button {
    width: 200px;
  }
}

.form-block {
  background: url("~@/assets/aihuman/board/custom-form-bg.png") no-repeat;
  background-size: cover;
  height: 500px;
  width: 1000px;
  border-radius: 20px;
  margin: 0 auto;
  padding: 30px;
}

.title-block {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 20px 0;

  &__text {
    font-weight: 500;
    font-size: 40px;
    color: #051232;
    line-height: 54px;
  }

  &__meta {
    font-weight: 400;
    font-size: 16px;
    color: #999999;
    line-height: 24px;
  }
}

.banner {
  background: url("~@/assets/aihuman/board/custom-banner.png") no-repeat center top;
  background-size: cover;
  height: 400px;
  width: 100%;
  padding: 90px 0 0 50px;
  box-sizing: border-box;
}

.banner-text1 {
  font-weight: bold;
  font-size: 72px;
  color: #051232;
}

.banner-text2 {
  font-weight: 400;
  font-size: 20px;
  color: #051232;
  line-height: 33px;
}

.banner-text3 {
  background: #2151D1;
  border-radius: 26px;
  opacity: 0.6;
  font-weight: bold;
  font-size: 28px;
  color: #FFFFFF;
  height: 40px;
  width: 250px;
  margin-top: 10px;
  line-height: 40px;
  text-align: center;
}
</style>
